package com.caigou.controller.front;

import com.caigou.bean.exam.entity.Users;
import com.caigou.component.CaigouIdComponent;
import com.caigou.security.utils.CurrentUser;
import com.caigou.service.IEsArticleService;
import com.caigou.util.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@RestController
@RequestMapping("/front/test/")
public class FrontTestController {

    @Resource
    private CaigouIdComponent caigouIdComponent;
    @Resource
    private IEsArticleService esArticleService;


    @PostMapping("/getCaigouId")
    public Result<Long> getCaigouId(@CurrentUser Users user) {
        log.info("日志={}",user);
        Long caigouId = caigouIdComponent.getCaigouIdCompnent();
        return Result.success(caigouId);
    }


    @PostMapping("es/participle")
    public Result<List<String>> esParticiple(String searchContent, int analyzerType) {
        List<String> strings = esArticleService.getIkAnalyzeSearchTerms(searchContent, analyzerType);
        return Result.success(strings);
    }





}
